
import axios from "axios";
import type {InternalAxiosRequestConfig,AxiosResponse} from "axios";


const service = axios.create({
    baseURL:"http://121.89.205.189:3000/admin/"
});

// 请求拦截器

// axios.interceptors.request.use();
service.interceptors.request.use((config:InternalAxiosRequestConfig)=>{

    // 给headers增加自定义属性token
    if(sessionStorage.getItem("token")){
        config.headers.token = sessionStorage.getItem("token")
    }
    // config.headers.token = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhZG1pbm5hbWUiOiJhZG1pbiIsImlhdCI6MTY3NzQ4NTM1MiwiZXhwIjoxNjc3NTE0MTUyfQ.JURGped01UNKJXyx7-Vi8DQqUSNVz0VCsIhbNt_xWq0";


    return config;
});

// 响应拦截器
service.interceptors.response.use((res:AxiosResponse)=>{


    return res;
});

export default service;